@aspan-corporation/ac-shared 1.2.33 → 1.2.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/utils/diary.js +8 -0
- package/package.json +1 -1
package/lib/utils/diary.js
CHANGED
|
@@ -99,6 +99,10 @@ export const tokenizeText = (markdown) => {
|
|
|
99
99
|
// fenced + inline code
|
|
100
100
|
.replace(/```[\s\S]*?```/g, " ")
|
|
101
101
|
.replace(/`[^`]*`/g, " ")
|
|
102
|
+
// angle-bracket image targets `` first — the destination may
|
|
103
|
+
// contain ")" (e.g. a filename like "image (2).jpg"), which the generic
|
|
104
|
+
// `\([^)]*\)` form below would mis-match.
|
|
105
|
+
.replace(/!\[([^\]]*)\]\(<[^>]*>\)/g, " $1 ")
|
|
102
106
|
// image / link targets: keep the visible text, drop the URL/key
|
|
103
107
|
.replace(/!\[([^\]]*)\]\([^)]*\)/g, " $1 ")
|
|
104
108
|
.replace(/\[([^\]]*)\]\([^)]*\)/g, " $1 ")
|
|
@@ -124,6 +128,10 @@ export const diaryPreview = (markdown) => {
|
|
|
124
128
|
const text = markdown
|
|
125
129
|
.replace(/```[\s\S]*?```/g, " ")
|
|
126
130
|
.replace(/`[^`]*`/g, " ")
|
|
131
|
+
// angle-bracket image targets first — the destination may contain ")"
|
|
132
|
+
// (e.g. "image (2).jpg"), which the generic form below would mis-match,
|
|
133
|
+
// leaking ".jpg )" into the preview.
|
|
134
|
+
.replace(/!\[[^\]]*\]\(<[^>]*>\)/g, " ")
|
|
127
135
|
.replace(/!\[([^\]]*)\]\([^)]*\)/g, " ")
|
|
128
136
|
.replace(/\[([^\]]*)\]\([^)]*\)/g, " $1 ")
|
|
129
137
|
.replace(/[#>*_~]+/g, " ")
|